package org.icec.iot.mqtt.client;

import org.icec.iot.mqtt.client.config.MqttSenderGateway;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class MqttJavaApplication {
	public static void main(String[] args) {
		ConfigurableApplicationContext context = new SpringApplicationBuilder(MqttJavaApplication.class)
				.web(WebApplicationType.NONE).run(args);
		MqttSenderGateway gateway = context.getBean(MqttSenderGateway.class);
	 
		for (int i = 0; i < 1000; i++) {
			gateway.sendToMqtt("foo", "root/test/aa");
			try {
				Thread.sleep(10);
			} catch (InterruptedException e) {
			}
		}
	}

}
